ig.module(
	'game.entities.base.baseToxic'
)
.requires(
	'impact.entity',
        'game.entities.base.dragme',
	'game.entities.base.basePlague'	
)
.defines(function()
{
    EntityBaseToxic = EntityDragme.extend(
    {     
	collides: ig.Entity.COLLIDES.PASSIVE,	        
	pickType: 'none',
	pickable: false,
	zIndex: 11,
	update: function()
	{	    
	    this.parent();
	    if (ig.input.released('mouse_left'))
	    {    		
		var plagues = ig.game.getEntitiesByType(EntityBasePlague);		    
		
		for (var i = 0; i < plagues.length; ++i)
		{
		    if (plagues[i].typeToPick == this.pickType || this.pickType == 'all')
		    {
			if (this.touches(plagues[i]) == true || plagues[i].touches(this))
			{
			    //if (ig.input.released('mouse_left'))
			    {
				this.kill();
				plagues[i].kill();
				ig.global.numberOfPicks++;
				break;
			    }
			}
		    }
		} 				
	    }
	},
	
	touches: function(other)
        {
	    var isTouched = this.parent(other);	    
	    return isTouched;
	}
    });
});